﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChoViet.Lib.Paging;
using System.Linq.Dynamic;
using ChoViet.Lib.Common;
using System.Web.Mvc;

namespace ChoViet.Model
{
    public enum DemandStatus
    {
        CanBan = 1, CanMua = 2, ChoThue = 3, CanThue = 4
    }
    public static class DemandStatusExtension
    {
        public static string ToString(this DemandStatus k)
        {
            switch (k)
            {
                case DemandStatus.CanBan:
                    return "Cần bán";
                case DemandStatus.CanMua:
                    return "Cần mua";
                case DemandStatus.CanThue:
                    return "Cần thuê";
                case DemandStatus.ChoThue:
                    return "Cho thuê";
                default: break;
            }
            throw new NotImplementedException();
        }
        public static List<SelectListItem> ToList()
        {
            List<SelectListItem> sls = new List<SelectListItem>();
            for (var i = DemandStatus.CanBan; i <= DemandStatus.ChoThue +1; i++)
            {
                var item = new SelectListItem();
                item.Text = DemandStatusExtension.ToString(i);
                item.Value = ((int)i).ToString();
                sls.Add(item);
            }
            return sls;
        }
    }
}
